package com.easymeeting.controller;

import java.util.List;

import com.easymeeting.entity.query.TbUserQuery;
import com.easymeeting.entity.po.TbUser;
import com.easymeeting.entity.vo.ResponseVO;
import com.easymeeting.service.TbUserService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 *  Controller
 */
@RestController("tbUserController")
@RequestMapping("/tbUser")
public class TbUserController extends ABaseController{

	@Resource
	private TbUserService tbUserService;
	/**
	 * 根据条件分页查询
	 */
	@RequestMapping("/loadDataList")
	public ResponseVO loadDataList(TbUserQuery query){
		return getSuccessResponseVO(tbUserService.findListByPage(query));
	}

	/**
	 * 新增
	 */
	@RequestMapping("/add")
	public ResponseVO add(TbUser bean) {
		tbUserService.add(bean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 批量新增
	 */
	@RequestMapping("/addBatch")
	public ResponseVO addBatch(@RequestBody List<TbUser> listBean) {
		tbUserService.addBatch(listBean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 批量新增/修改
	 */
	@RequestMapping("/addOrUpdateBatch")
	public ResponseVO addOrUpdateBatch(@RequestBody List<TbUser> listBean) {
		tbUserService.addBatch(listBean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 根据Id查询对象
	 */
	@RequestMapping("/getTbUserById")
	public ResponseVO getTbUserById(Integer id) {
		return getSuccessResponseVO(tbUserService.getTbUserById(id));
	}

	/**
	 * 根据Id修改对象
	 */
	@RequestMapping("/updateTbUserById")
	public ResponseVO updateTbUserById(TbUser bean,Integer id) {
		tbUserService.updateTbUserById(bean,id);
		return getSuccessResponseVO(null);
	}

	/**
	 * 根据Id删除
	 */
	@RequestMapping("/deleteTbUserById")
	public ResponseVO deleteTbUserById(Integer id) {
		tbUserService.deleteTbUserById(id);
		return getSuccessResponseVO(null);
	}
}